package com.sop.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sop.model.OrganizationalInfo;
import com.sop.model.WatchArrangements;
import com.sop.model.vo.OrganizationalInfoVo;
import com.sop.model.vo.WatchArrangementsVo;
import com.sop.service.OrganizationalService;

import common.base.GridPage;

@Controller
@RequestMapping("organizational")
public class OrganizationalController {

	@Autowired                     
	private OrganizationalService  organizationalService;
	
	@ResponseBody
	@RequestMapping("/findAll")
	public List<OrganizationalInfo>  findAll(){
		List<OrganizationalInfo> organizationalList = organizationalService.findAll();
		return organizationalList;
	}
	
	/**
	 * 高级搜索
	 * @param organizationalInfoVo
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/findByPages")
	public GridPage<OrganizationalInfo>  findByPages(OrganizationalInfoVo  organizationalInfoVo){
		return  organizationalService.findPagerBySearchVo(organizationalInfoVo);
	}
	
	@ResponseBody
	@RequestMapping("/add")
	public OrganizationalInfo  add(OrganizationalInfo info){
		OrganizationalInfo organizational = organizationalService.add(info);
		return organizational;
	}
	
	@ResponseBody
	@RequestMapping("/update")
	public OrganizationalInfo  update(OrganizationalInfo info){
		OrganizationalInfo organizational = organizationalService.update(info);
		return organizational;
	}
	
	@ResponseBody
	@RequestMapping("/delete")
	public boolean  delete(Integer id){
		organizationalService.delete(id);
		return true;
	}
}
